{% extends "base.html" %}

{% block content %}
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title mb-0">创建运输任务</h4>
                </div>
                <div class="card-body">
                    <form method="POST">
                        <div class="mb-3">
                            <label class="form-label">选择样本</label>
                            <select class="form-select" name="storage_id" required>
                                <option value="">请选择需要运输的样本</option>
                                {% for storage in storages %}
                                <option value="{{ storage.id }}">
                                    {{ storage.sample_code }} 
                                    ({{ '组织样本' if storage.sample_type == 'tissue' 
                                        else '血液样本' if storage.sample_type == 'blood'
                                        else 'DNA样本' if storage.sample_type == 'dna'
                                        else 'RNA样本' if storage.sample_type == 'rna'
                                        else '蛋白质样本' if storage.sample_type == 'protein'
                                        else storage.sample_type }})
                                </option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">车牌号</label>
                            <input type="text" class="form-control" name="vehicle_number" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">司机姓名</label>
                            <input type="text" class="form-control" name="driver_name" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">联系电话</label>
                            <input type="text" class="form-control" name="driver_phone" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">起点位置</label>
                            <input type="text" class="form-control" name="start_location" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">终点位置</label>
                            <input type="text" class="form-control" name="end_location" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">开始时间</label>
                            <input type="datetime-local" class="form-control" name="start_time" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">预计到达时间</label>
                            <input type="datetime-local" class="form-control" name="estimated_arrival_time" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">备注</label>
                            <textarea class="form-control" name="notes" rows="3"></textarea>
                        </div>
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">创建任务</button>
                            <a href="{{ url_for('storage.transport_list') }}" class="btn btn-secondary">返回</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 